
package com.android.generator.callback;

import java.util.ArrayList;
import java.util.List;

public abstract class CallbackHandler<Callback> {

    public CallbackHandler() {
        mCallbackList = new ArrayList<>();
    }

    protected ArrayList<Callback> mCallbackList = null;

    public void registerCallback(Callback callback) {
        if (!mCallbackList.contains(callback)) {
            mCallbackList.add(callback);
        }
    }

    public void unRegisterCallback(Callback callback) {
        if (mCallbackList.contains(callback)) {
            mCallbackList.remove(callback);
        }
    }

    protected List<Callback> getCallbacks() {
        return mCallbackList;
    }

}
